

package org.yaukie.builder;

import java.util.Date;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;

public class QuartzListener implements JobListener {
    public QuartzListener() {
    }

    public String getName() {
        return (new Date()).getTime() + "QuartzListener";
    }

    public void jobToBeExecuted(JobExecutionContext context) {
    }

    public void jobExecutionVetoed(JobExecutionContext context) {
    }

    public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
        String jobName = context.getJobDetail().getKey().getName();
        String jobGroupName = context.getJobDetail().getKey().getGroup();
        String triggerName = context.getTrigger().getKey().getName();
        String triggerGroupName = context.getTrigger().getKey().getGroup();
        QuartzManager.removeJob(jobName, jobGroupName, triggerName, triggerGroupName);
    }
}
